home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 December / CMCD1203.ISO / Software / Freeware / Grafica / advem / aemf10.exe / {app} / templates / jsmatriximage.js < prev    next >
Text File  |  2003-05-28  |  5KB  |  140 lines

  1. document.writeln(''); var glyphs=new Array(); document.write('');
  2. document.writeln(''); glyphs.push("../filehandling/readfile.jsp?fn=matrix1b.jpg"); document.write('');
  3. document.writeln(''); glyphs.push("../filehandling/readfile.jsp?fn=matrix2b.jpg"); document.write('');
  4. document.writeln(''); glyphs.push("../filehandling/readfile.jsp?fn=matrix3b.jpg"); document.write('');
  5. document.writeln(''); glyphs.push("../filehandling/readfile.jsp?fn=matrix4b.jpg"); document.write('');
  6. document.writeln(''); glyphs.push("../filehandling/readfile.jsp?fn=matrix5b.jpg"); document.write('');
  7. document.writeln(''); glyphs.push("../filehandling/readfile.jsp?fn=matrix6b.jpg"); document.write('');
  8. document.writeln(''); glyphs.push("../filehandling/readfile.jsp?fn=matrix7b.jpg"); document.write('');
  9. document.writeln(''); glyphs.push("../filehandling/readfile.jsp?fn=matrix8b.jpg"); document.write('');
  10. document.writeln(''); glyphs.push("../filehandling/readfile.jsp?fn=matrix9b.jpg"); document.write('');
  11.  
  12.  
  13.  
  14. // MATRIX BACKGROUND ANIMATION
  15. // By: BRIAN GOSSELIN OF http://scriptasylum.com
  16. // V1.0
  17. // Permission granted to use this script in your webpage provided the
  18. // credit remain intact.
  19.  
  20. //GLYPH IMAGE FILE NAMES.
  21. var glyphs_b=glyphs;
  22.  
  23. var glyphCount=400;
  24. var scrollSpeed=60;
  25. var glyphD=15;
  26. var disableColors=false;
  27. var matrbr = 100;
  28. var matrno = 50;
  29.  
  30. //************ DO NOT EDIT BEYOND HERE *************\\
  31.  
  32. var w3c=(document.getElementById)?true:false;
  33. var ns4=(document.layers)?true:false;
  34. var ie4=(document.all && !w3c)?true:false;
  35. var ie5=(document.all && w3c)?true:false;
  36. var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:false;
  37. var ie = (navigator.appVersion.indexOf("MSIE")>=0)?true:false;
  38. var px = (window.opera)?'':'px';
  39. var ids=new Array();
  40. var wWidth, wHeight, colHeight;
  41. var t='';
  42. var counter=0;
  43. var gx=new Array();
  44. var ga=new Array();
  45.  
  46. for(i=0;i<glyphCount;i++){
  47. gx[i]=Math.floor(Math.random()*glyphs.length);
  48. t+=(ns4)?'<layer name="glyph'+i+'" top="-'+glyphD+'" left="0" width="'+glyphD+'" height="'+glyphD+'" z-index="1">':'<div id="glyph'+i+'" style="position:absolute; top:-'+glyphD+'px; left:0px; width:'+glyphD+'px; height:'+glyphD+'px; z-index:1">';
  49. t+='<img src="'+glyphs[gx[i]]+'" width='+glyphD+' height='+glyphD+' name="g'+i+'" style="filter:alpha(opacity='+matrno+'); -moz-opacity:'+(matrno/100)+'">';
  50. t+=(ns4)?'</layer>':'</div>';
  51. }
  52. document.write(t);
  53.  
  54. for(i=0;i<glyphs.length;i++){
  55. ga[i]=new Image();
  56. ga[i].src=glyphs_b[i];
  57. }
  58.  
  59. function matrixInit(){
  60. getWindowDims();
  61. for(i=0;i<glyphCount;i++){
  62. ids[i]=(ns4)?document.layers['glyph'+i]:(ie4)?document.all['glyph'+i]:document.getElementById('glyph'+i);
  63. ids[i].gx=gx[i];
  64. }
  65. gx='';
  66. //setInterval('scrollGlyphs()',10*scrollSpeed);
  67. scrollGlyphs();
  68. }
  69.  
  70. function brighten(idnum,b){
  71. if (ie) document.images['g'+idnum].filters.alpha.opacity=(b)?matrbr:matrno; else document.images['g'+idnum].style.MozOpacity=((b)?matrbr:matrno)/100;
  72. }
  73.  
  74. function moveID(idnum,x,y){
  75. var id=ids[idnum];
  76. if(ns4)id.moveTo(x,y);
  77. else{
  78. id.style.left=x+px;
  79. id.style.top=y+px;
  80. }
  81. if(!disableColors){
  82. brighten(idnum,true);
  83. setTimeout('brighten('+idnum+',false)',scrollSpeed*1.3);
  84. }}
  85.  
  86. function getWindowDims(){
  87. wWidth=((ie4||ie5)&&!window.opera)? document.body.clientWidth:window.innerWidth;
  88. wHeight=((ie4||ie5)&&!window.opera)? document.body.clientHeight:window.innerHeight;
  89. colHeight=Math.min(Math.floor(wHeight/1.5/glyphD)-1,25);
  90. }
  91.  
  92. function scrollGlyphs(){
  93. var sx=((ie4||ie5)&&!window.opera)? document.body.scrollLeft:window.pageXOffset;
  94. var sy=((ie4||ie5)&&!window.opera)? document.body.scrollTop:window.pageYOffset;
  95. var pixx=Math.floor(Math.random()*wWidth/(glyphD+1))*glyphD+sx;
  96. var pixy=Math.floor(Math.random()*(wHeight-(colHeight*glyphD)))+sy;
  97. for(i=0; i<colHeight; i++){
  98. setTimeout('moveID('+counter+','+pixx+','+(pixy+glyphD*i)+')', scrollSpeed*i);
  99. counter=((counter+colHeight)>glyphCount)?0:counter+1;
  100. }
  101. setTimeout('scrollGlyphs()', scrollSpeed*colHeight/2);
  102. }
  103.  
  104. window.onload=matrixInit;
  105. window.onresize=getWindowDims;
  106.  
  107.  
  108.  
  109. //DO NOT MODIFY
  110. /*
  111. <APPLETINFO>
  112. appletname=jsmatriximage
  113. applettype=JAVASCRIPT
  114. created=1054117706580
  115. appletfilename=jsmatriximage1.js
  116. </APPLETINFO>
  117. <JAVASCRIPT>
  118. gcount=400
  119. sspeed=60
  120. imdims=15
  121. matrbr=100
  122. matrno=50
  123. </JAVASCRIPT>
  124. <HTMLGENERATOR>
  125. image=-
  126. image_GS=2;images
  127. mystarttag=-
  128. mystarttag_GS=1;-
  129. images_GS=4;-
  130. images0=matrix1b.jpg
  131. images1=matrix2b.jpg
  132. images2=matrix3b.jpg
  133. images3=matrix4b.jpg
  134. images4=matrix5b.jpg
  135. images5=matrix6b.jpg
  136. images6=matrix7b.jpg
  137. images7=matrix8b.jpg
  138. images8=matrix9b.jpg
  139. </HTMLGENERATOR>
  140. */